package work.sby.mapper;

import org.apache.ibatis.annotations.*;
import work.sby.pojo.Brand;
import work.sby.pojo.Buy;
import java.util.List;
public interface BuyMapper {
    @Select("SELECT * FROM tb_buy")
    @ResultMap("buyResultMap")
    List<Buy> selectBuy();

    @Select("SELECT * FROM tb_buy WHERE buyername = #{buyername} ")
    @ResultMap("buyResultMap")
    List<Buy> selectByBuyName(@Param("buyername") String buyername);

    @Update("UPDATE tb_buy SET pay = 1 WHERE id = #{id} AND buyername = #{buyername}")
    int updatePayValue(@Param("id") int id, @Param("buyername") String buyername);

    @Delete("DELETE FROM tb_buy WHERE id = #{id} AND buyername = #{buyername}")
    int deleteByIdAndBuyName(@Param("id") int id, @Param("buyername") String buyername);

    @Insert("insert into tb_buy values(null,#{buyername},#{goodname},0)")
    void addbuy( @Param("buyername") String buyername,@Param("goodname") String goodname);

}

